package com.zl.service;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zl.dao.NewsDao;
import com.zl.dao.WebsiteDao;
import com.zl.entity.Details;
import com.zl.entity.Website;

@Service
public class NewsService {
	@Autowired
	private NewsDao newsDao;
	@Autowired
	private WebsiteDao websiteDao;
	public Details selectDetailById(Details details){
		details.setTableName("zzd_content."+details.getTableName());
		Details detail = newsDao.selectDetailById(details);
		String columnId = detail.getColumnId();
		if(StringUtils.isNotBlank(columnId)){
			Website website = websiteDao.selectWebsite(columnId);
			detail.setUrl(website.getUrl());
			detail.setWebsiteName(website.getName());
		}
		return detail;
	}
}
